<?php
session_start();
function make_seed() 
{
    list($usec, $sec) = explode(' ', microtime());
    return (float) $sec + ((float) $usec * 100000);
}
mt_srand(make_seed());
$nonce1 = mt_rand(1, 10000000); 
$nonce1 = substr(md5($nonce),0,4); 
$_SESSION['nonce'] = $nonce; 
header ("Content-type: image/png");
$handle = ImageCreate (50, 25) or exit ("Error when creating the image");
$text_color = ImageColorAllocate ($handle, 255, 255, 255);
$text_color = ImageColorAllocate ($handle, 0, 0, 0);
ImageString ($handle, 31, 5, 5,  $nonce1, $text_color);
ImagePng ($handle);
?> 